package com.yc.cloud.portal.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yc.cloud.basic.dto.BaseQueryParam;
import com.yc.cloud.entity.MemberAccount;
import com.yc.cloud.portal.dto.request.MemberAccountCreateParam;
import com.yc.cloud.portal.dto.request.MemberAccountRegisterParam;
import com.yc.cloud.portal.dto.request.MemberAccountUpdateParam;
import com.yc.cloud.portal.vo.MemberAccountVo;
import com.yc.cloud.security.dto.MemberUserDetails;
import com.yc.cloud.wechat.dto.request.WxAuthorizeParam;
import com.yc.cloud.wechat.dto.request.WxBarCodeCreateParam;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author Yancy
 * @since 2023-12-23
 */
public interface MemberAccountService extends IService<MemberAccount> {

    /***
     * description:查询列表
     * @param param 查询条件
     * @return 数据信息
     */
    IPage<MemberAccountVo> list(BaseQueryParam param);

    MemberUserDetails loadUserByUsername(String username);

    String login(String username, String password);

    String registerOrLoginWithWeChat(WxAuthorizeParam param);

    MemberAccount getByUserName(String username);

    boolean register(MemberAccountRegisterParam param);

    boolean update(Long memberId, MemberAccountUpdateParam param);


    /**
     * 给用户开通vip,并增会员到期时间
     *
     * @param memberId 会员ID
     * @param month    最小单位几个月
     * @param day      天
     * @return true or false
     */
    boolean addMemberVipExpireTime(Long memberId, int month, int day);


    String createQrCode(WxBarCodeCreateParam param);

    MemberAccountVo convertVo(MemberAccount memberAccount);

    MemberAccount create(MemberAccountCreateParam param);
}

